import { ipcMain, app } from 'electron'
import { getWindowByEvent } from '../utils/window'

ipcMain.handle('getVersion', () => app.getVersion())

ipcMain.handle('getName', () => app.getName())

// 最小化
ipcMain.on('minimize', (event) => {
  const window = getWindowByEvent(event)
  if (window) {
    window.minimize()
  }
})

// 关闭
ipcMain.on('close', (event) => {
  const window = getWindowByEvent(event)
  if (window) {
    window.close()
  }
})
